<?php

declare(strict_types=1);

namespace app\seller\model;

use app\shop\model\Shop;
use sheep\model\Common;
use think\model\concern\SoftDelete;

class NurseType extends Common
{
    use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $name = 'nurse_type';

    // 状态获取器
    public function getStatusAttr($value, $data): string
    {
        $status = [0 => '启用', 1 => '禁用'];
        return $status[$data['status']];
    }

    // 获取宠护员列表
    public function typeInfo()
    {
        return self::where(['status' => 0])->field('id, nurse_type_name')->select();
    }

    // 模型关联宠护员类型
    public function nurse()
    {
        return $this->hasOne(Nurse::class, 'id', 'nurse_type_id');
    }
}
